package com.ruoyi.common.common;


/**
 * @author ：jiangguanjun
 * @description：TODO
 * @date ：2020/7/14 21:23
 */
public class GlobalValue {
    /**
     * 网关放行的url的key
     */
    public static final String URL_PASS_KEY = "URL_PASS_KEY";

    /**
     * 放行路径在redis里面存储时候的分隔符
     */
    public static final String URL_PASS_SPLIT = "|";

    /**
     * session存储图片验证码的前缀
     */
    public static final String IMAGE_SESSION_KEY_FREFIX = "IMAGE_CODE_";

    /**
     * 图片验证码的生成基库
     */
    public static final String IMAGE_CODE_RANDOM = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    /**
     * 图片验证码redis里面的过期时间
     */
    public static final Long IMAGE_CODE_TIMEOUT = 600000000L;

    /**
     * 评论里面path的分隔符
     */
    public static final String PATH_SPLIT_SIGN = ".";

    /**
     * 短信redis存储的key前缀
     */
    public static final String SMS_CODE_FREFIX = "SMS_" ;

    /**
     * 短信验证码失效时间
     */
    public static final Long SMS_CODED_TIMEOUT = 300000L ;
    /**
     * 图片分隔符
     */
    public static final String IMAGE_SPLIT = "," ;

    public static final String CUSTROME_REPEAT_FREFIX = "CUSTROME_REPEAT_" ;

    /**
     * 浏览网页ip重复校验
     */
    public static final String VISIT_RERPEAT_PREFIX = "VISIT_IP_REPEAT_" ;

    /**
     * 会员购买天数
     */
    public static final Integer VIP_BUY_DAY = 365 ;


    public static final String USER_CODE_FREFIX = "user_code_" ;

    public static final String USER_CODE_LIMIT = "user:code:limit:" ;

    public static final Integer USER_CODE_TIMES_LIMIT = 3 ;

    public static final Long USER_CODE_TIME_LIMIT = 24*60*60L ;

    private static final String PHONE_CODE_DELY = "phone:code:dely:" ;

    /**
     * 购买vip订单号的前面标记
     */
    public static final String BUY_VIP_ORDER_FREFIX = "vip" ;


    /**
     *
     * @param phone 获取短信验证码的手机号
     * @return
     */
    public  static String getSmsRedisKey(String phone){
        return SMS_CODE_FREFIX+phone ;
    }
    /**
     * @author jiangguanjun
     * @date 2023/10/10 16:45
     * @param
     * @return
     * @desc 获取手机号次数
     */
    public static CodeLimit getSmsLimitCount(String phone){
        CodeLimit codeLimit = new CodeLimit() ;
        codeLimit.setKey(USER_CODE_LIMIT+phone);
        codeLimit.setExpire(USER_CODE_TIME_LIMIT);
        codeLimit.setMaxCount(USER_CODE_TIMES_LIMIT);
        return codeLimit ;
    }

    /**
     * @author jiangguanjun
     * @date 2023/10/10 17:03
     * @param
     * @return
     * @desc
     */
    public static String getPhoneCodeDely(String phone){
        return PHONE_CODE_DELY+phone ;
    }

    public static String getCustomerRedisKey(String cuIp){
        return CUSTROME_REPEAT_FREFIX+cuIp ;
    }

    public static String getVisttIpKey (String vIp){

        return VISIT_RERPEAT_PREFIX+vIp ;
    }

    public static String userCodeRedisKey(String phone){
        return USER_CODE_FREFIX+phone ;
    }
}
